import { message, Modal } from "ant-design-vue";
import { onUnmounted, h, VNode } from "vue";

/**
 * 使用Modal
 * @param VNode 自定义节点
 * @param okCallBack 点击确定时的回调函数
 */
export default function (title: string, vNode: VNode, okCallBack: Function) {
  const modal = Modal.confirm({
    title,
    icon: () => null,
    onOk: okCallBack(),
    centered: true,
    closable: true,
    content: () => vNode,
  });
  onUnmounted(() => modal.destroy());
  return modal;
}
